<html>
<head><meta charset="utf-8"><title>debug stage0 segfault on stage1 · t-compiler · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/index.html">t-compiler</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/debug.20stage0.20segfault.20on.20stage1.html">debug stage0 segfault on stage1</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="175979111"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/debug%20stage0%20segfault%20on%20stage1/near/175979111" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/debug.20stage0.20segfault.20on.20stage1.html#175979111">(Sep 18 2019 at 07:42)</a>:</h4>
<p>Can someone help with <a href="https://github.com/rust-lang/rustc-guide/issues/443" target="_blank" title="https://github.com/rust-lang/rustc-guide/issues/443">https://github.com/rust-lang/rustc-guide/issues/443</a> ?</p>



<a name="175979132"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/debug%20stage0%20segfault%20on%20stage1/near/175979132" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/debug.20stage0.20segfault.20on.20stage1.html#175979132">(Sep 18 2019 at 07:43)</a>:</h4>
<p>A user is trying to debug a segfault in the stage0 compiler while building stage1</p>



<a name="175979155"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/debug%20stage0%20segfault%20on%20stage1/near/175979155" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/debug.20stage0.20segfault.20on.20stage1.html#175979155">(Sep 18 2019 at 07:43)</a>:</h4>
<p>just doing <code>gdb --args ...</code> with the rustc command that fails doesn't work, because environment variables that x.py sets are apparently missing</p>



<a name="175979171"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/debug%20stage0%20segfault%20on%20stage1/near/175979171" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/debug.20stage0.20segfault.20on.20stage1.html#175979171">(Sep 18 2019 at 07:43)</a>:</h4>
<p>How does one debug this ?</p>



<a name="175979881"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/debug%20stage0%20segfault%20on%20stage1/near/175979881" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/debug.20stage0.20segfault.20on.20stage1.html#175979881">(Sep 18 2019 at 07:53)</a>:</h4>
<p>ideally we'd add a <code>--gdb</code> command to <code>x.py</code> that reruns the last crashed command with gdb</p>



<a name="175979887"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/debug%20stage0%20segfault%20on%20stage1/near/175979887" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/debug.20stage0.20segfault.20on.20stage1.html#175979887">(Sep 18 2019 at 07:53)</a>:</h4>
<p>until then, I think it would suffice to dump the env vars, too</p>



<a name="175979954"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/debug%20stage0%20segfault%20on%20stage1/near/175979954" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/debug.20stage0.20segfault.20on.20stage1.html#175979954">(Sep 18 2019 at 07:54)</a>:</h4>
<p>maybe into a log file ?</p>



<a name="175979960"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/debug%20stage0%20segfault%20on%20stage1/near/175979960" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/debug.20stage0.20segfault.20on.20stage1.html#175979960">(Sep 18 2019 at 07:54)</a>:</h4>
<p>the envar dump can be huge</p>



<a name="175979979"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/debug%20stage0%20segfault%20on%20stage1/near/175979979" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/debug.20stage0.20segfault.20on.20stage1.html#175979979">(Sep 18 2019 at 07:55)</a>:</h4>
<p>we could then provide a command that uses a sub-shell to load the env vars from the log file, and then executes the command</p>



<a name="175980120"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/debug%20stage0%20segfault%20on%20stage1/near/175980120" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/debug.20stage0.20segfault.20on.20stage1.html#175980120">(Sep 18 2019 at 07:57)</a>:</h4>
<p>I just mean the necessary ones</p>



<a name="175980132"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/debug%20stage0%20segfault%20on%20stage1/near/175980132" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/debug.20stage0.20segfault.20on.20stage1.html#175980132">(Sep 18 2019 at 07:57)</a>:</h4>
<p>we know the rustc env vars needed</p>



<a name="175980134"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/debug%20stage0%20segfault%20on%20stage1/near/175980134" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/debug.20stage0.20segfault.20on.20stage1.html#175980134">(Sep 18 2019 at 07:57)</a>:</h4>
<p>Do we always know?</p>



<a name="175980136"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/debug%20stage0%20segfault%20on%20stage1/near/175980136" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/debug.20stage0.20segfault.20on.20stage1.html#175980136">(Sep 18 2019 at 07:57)</a>:</h4>
<p>ah ok</p>



<a name="175980195"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/debug%20stage0%20segfault%20on%20stage1/near/175980195" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/debug.20stage0.20segfault.20on.20stage1.html#175980195">(Sep 18 2019 at 07:58)</a>:</h4>
<p>otherwise we could only access env vars via a wrapper that caches all the ones accessed</p>



<a name="175980199"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/debug%20stage0%20segfault%20on%20stage1/near/175980199" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/debug.20stage0.20segfault.20on.20stage1.html#175980199">(Sep 18 2019 at 07:58)</a>:</h4>
<p>and dump those</p>



<a name="175980240"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/debug%20stage0%20segfault%20on%20stage1/near/175980240" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/debug.20stage0.20segfault.20on.20stage1.html#175980240">(Sep 18 2019 at 07:59)</a>:</h4>
<p><span class="user-mention" data-user-id="124288">@oli</span> or is it there a list somewhere ?</p>



<a name="175980259"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/debug%20stage0%20segfault%20on%20stage1/near/175980259" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/debug.20stage0.20segfault.20on.20stage1.html#175980259">(Sep 18 2019 at 07:59)</a>:</h4>
<p>It's just the three or four mentioned on the issue. I've added them manually many times</p>



<a name="175980332"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/debug%20stage0%20segfault%20on%20stage1/near/175980332" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/debug.20stage0.20segfault.20on.20stage1.html#175980332">(Sep 18 2019 at 08:00)</a>:</h4>
<p>basically one can test it out once to figure out the missing ones and then have the command printer print the env vars, too</p>



<a name="175980512"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/debug%20stage0%20segfault%20on%20stage1/near/175980512" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/debug.20stage0.20segfault.20on.20stage1.html#175980512">(Sep 18 2019 at 08:03)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/blob/43a5ff4222e1f217ac14331afd59f82ec4204d12/src/bootstrap/bin/rustc.rs#L64" target="_blank" title="https://github.com/rust-lang/rust/blob/43a5ff4222e1f217ac14331afd59f82ec4204d12/src/bootstrap/bin/rustc.rs#L64">https://github.com/rust-lang/rust/blob/43a5ff4222e1f217ac14331afd59f82ec4204d12/src/bootstrap/bin/rustc.rs#L64</a></p>



<a name="175980533"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/debug%20stage0%20segfault%20on%20stage1/near/175980533" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/debug.20stage0.20segfault.20on.20stage1.html#175980533">(Sep 18 2019 at 08:03)</a>:</h4>
<p>So I think we could there cache all the variables accessed</p>



<a name="175982524"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/debug%20stage0%20segfault%20on%20stage1/near/175982524" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/debug.20stage0.20segfault.20on.20stage1.html#175982524">(Sep 18 2019 at 08:32)</a>:</h4>
<p>I've opened a PR for dumping the env-vars: <a href="https://github.com/rust-lang/rust/issues/64574" target="_blank" title="https://github.com/rust-lang/rust/issues/64574">#64574</a></p>



<a name="175984671"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/debug%20stage0%20segfault%20on%20stage1/near/175984671" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/debug.20stage0.20segfault.20on.20stage1.html#175984671">(Sep 18 2019 at 09:00)</a>:</h4>
<blockquote>
<p>basically one can test it out once to figure out the missing ones and then have the command printer print the env vars, too</p>
</blockquote>
<p>In my experience, you need to run it several times to learn <em>all</em> the missing ones, because it fails-fast on the first one that is missing. I am surprised <span class="user-mention" data-user-id="124288">@oli</span> does not find this to be a big annoyance.</p>



<a name="175984728"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/debug%20stage0%20segfault%20on%20stage1/near/175984728" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/debug.20stage0.20segfault.20on.20stage1.html#175984728">(Sep 18 2019 at 09:01)</a>:</h4>
<p>I don't do this often enough to have been annoyed by it enough</p>



<a name="175985126"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/debug%20stage0%20segfault%20on%20stage1/near/175985126" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/debug.20stage0.20segfault.20on.20stage1.html#175985126">(Sep 18 2019 at 09:06)</a>:</h4>
<p>I'm not really annoyed by it, but the user that is cannot fix it, and I want them to do something for me :D</p>



<a name="175986782"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/debug%20stage0%20segfault%20on%20stage1/near/175986782" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/debug.20stage0.20segfault.20on.20stage1.html#175986782">(Sep 18 2019 at 09:31)</a>:</h4>
<p>by the way I think in the past, <span class="user-mention" data-user-id="123586">@nagisa</span> has advised using <code>x.py --on-fail</code> as a way to deal with this (in terms of attempting to observe the state of the system at the time of failure.</p>



<a name="175986800"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/debug%20stage0%20segfault%20on%20stage1/near/175986800" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/debug.20stage0.20segfault.20on.20stage1.html#175986800">(Sep 18 2019 at 09:31)</a>:</h4>
<p><span class="user-mention" data-user-id="124288">@oli</span> so that place isn't enough to dump the env vars</p>



<a name="175986805"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/debug%20stage0%20segfault%20on%20stage1/near/175986805" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/debug.20stage0.20segfault.20on.20stage1.html#175986805">(Sep 18 2019 at 09:31)</a>:</h4>
<p>/me looks for context</p>



<a name="175986810"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/debug%20stage0%20segfault%20on%20stage1/near/175986810" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/debug.20stage0.20segfault.20on.20stage1.html#175986810">(Sep 18 2019 at 09:31)</a>:</h4>
<p>i was trying to see if i could add a test</p>



<a name="175986917"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/debug%20stage0%20segfault%20on%20stage1/near/175986917" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/debug.20stage0.20segfault.20on.20stage1.html#175986917">(Sep 18 2019 at 09:32)</a>:</h4>
<p>ah yes, context is <a href="https://github.com/rust-lang/rust/issues/38686" target="_blank" title="https://github.com/rust-lang/rust/issues/38686">#38686</a></p>



<a name="175986944"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/debug%20stage0%20segfault%20on%20stage1/near/175986944" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/debug.20stage0.20segfault.20on.20stage1.html#175986944">(Sep 18 2019 at 09:33)</a>:</h4>
<p>So I decided to make typeck abort, and see if I could see the env vars: </p>
<div class="codehilite"><pre><span></span>aused by:
  process didn&#39;t exit successfully: `/rust/build/bootstrap/debug/rustc --edition=2018 --crate-name core src/libcore/lib.rs   ...` (signal: 6, SIGABRT: process abort signal)
command did not execute successfully: &quot;rust/build/x86_64-apple-darwin/stage0/bin/cargo&quot; &quot;build&quot; ...&quot;
expected success, got: exit code: 101
failed to run: rust/build/bootstrap/debug/bootstrap test
Build completed unsuccessfully in 0:00:31
</pre></div>



<a name="175986971"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/debug%20stage0%20segfault%20on%20stage1/near/175986971" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/debug.20stage0.20segfault.20on.20stage1.html#175986971">(Sep 18 2019 at 09:33)</a>:</h4>
<p>So apparently rustc is called by cargo here, and not by the bootstrap script</p>



<a name="175987001"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/debug%20stage0%20segfault%20on%20stage1/near/175987001" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/debug.20stage0.20segfault.20on.20stage1.html#175987001">(Sep 18 2019 at 09:33)</a>:</h4>
<p>When is it called by one or the other ?</p>



<a name="175987093"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/debug%20stage0%20segfault%20on%20stage1/near/175987093" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/debug.20stage0.20segfault.20on.20stage1.html#175987093">(Sep 18 2019 at 09:34)</a>:</h4>
<p>That error reporting comes from cargo, so I'm not sure how to fix this</p>



<a name="175987111"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/debug%20stage0%20segfault%20on%20stage1/near/175987111" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/debug.20stage0.20segfault.20on.20stage1.html#175987111">(Sep 18 2019 at 09:34)</a>:</h4>
<p>IIUC cargo would need to be able to query from rustc the environment variables that rustc reads</p>



<a name="175987146"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/debug%20stage0%20segfault%20on%20stage1/near/175987146" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/debug.20stage0.20segfault.20on.20stage1.html#175987146">(Sep 18 2019 at 09:35)</a>:</h4>
<p>Right now if the command cargo launches errors, cargo prints the command and the error code, but that's it</p>



<a name="175987195"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/debug%20stage0%20segfault%20on%20stage1/near/175987195" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/debug.20stage0.20segfault.20on.20stage1.html#175987195">(Sep 18 2019 at 09:35)</a>:</h4>
<p><span class="user-mention" data-user-id="132920">@gnzlbg</span> for your particular scenario/user, would the <code>--on-fail</code> approach work? I don't know whether that is agnostic to whether it is a <code>cargo</code> failure or a <code>rustc</code> one, but I would have assumed it is</p>



<a name="175987254"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/debug%20stage0%20segfault%20on%20stage1/near/175987254" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/debug.20stage0.20segfault.20on.20stage1.html#175987254">(Sep 18 2019 at 09:36)</a>:</h4>
<p>I'd have to look at what --on-fail does</p>



<a name="175987281"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/debug%20stage0%20segfault%20on%20stage1/near/175987281" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/debug.20stage0.20segfault.20on.20stage1.html#175987281">(Sep 18 2019 at 09:36)</a>:</h4>
<p>it is described in PR <a href="https://github.com/rust-lang/rust/issues/39888" target="_blank" title="https://github.com/rust-lang/rust/issues/39888">#39888</a></p>



<a name="175987306"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/debug%20stage0%20segfault%20on%20stage1/near/175987306" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/debug.20stage0.20segfault.20on.20stage1.html#175987306">(Sep 18 2019 at 09:36)</a>:</h4>
<p>it sounds like you can do <code>x.py --on-fail=bash</code>, and if a command fails, it will fire up an interactive shell</p>



<a name="175987341"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/debug%20stage0%20segfault%20on%20stage1/near/175987341" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/debug.20stage0.20segfault.20on.20stage1.html#175987341">(Sep 18 2019 at 09:37)</a>:</h4>
<p>sure, but does it let you attach a debugger ?</p>



<a name="175987357"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/debug%20stage0%20segfault%20on%20stage1/near/175987357" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/debug.20stage0.20segfault.20on.20stage1.html#175987357">(Sep 18 2019 at 09:37)</a>:</h4>
<p>ah the interactive shell allows you to launch a debugger with the same command preserving the environment ?</p>



<a name="175987365"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/debug%20stage0%20segfault%20on%20stage1/near/175987365" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/debug.20stage0.20segfault.20on.20stage1.html#175987365">(Sep 18 2019 at 09:37)</a>:</h4>
<p>exactly.</p>



<a name="175987425"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/debug%20stage0%20segfault%20on%20stage1/near/175987425" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/debug.20stage0.20segfault.20on.20stage1.html#175987425">(Sep 18 2019 at 09:38)</a>:</h4>
<p>Now, to be honest, I've never actually deployed this workflow <em>myself</em> ...</p>



<a name="175987438"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/debug%20stage0%20segfault%20on%20stage1/near/175987438" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/debug.20stage0.20segfault.20on.20stage1.html#175987438">(Sep 18 2019 at 09:38)</a>:</h4>
<p>but that doesn't mean it won't work for you</p>



<a name="175987481"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/debug%20stage0%20segfault%20on%20stage1/near/175987481" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/debug.20stage0.20segfault.20on.20stage1.html#175987481">(Sep 18 2019 at 09:39)</a>:</h4>
<div class="message_inline_image"><a href="http://www.patricialadd.com/wp-content/uploads/itmightwork.png" target="_blank" title="http://www.patricialadd.com/wp-content/uploads/itmightwork.png"><img src="https://uploads.zulipusercontent.net/0949312892dcf92ca3f283ad89dc717464a0db6e/687474703a2f2f7777772e70617472696369616c6164642e636f6d2f77702d636f6e74656e742f75706c6f6164732f69746d69676874776f726b2e706e67"></a></div>



<a name="175987526"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/debug%20stage0%20segfault%20on%20stage1/near/175987526" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/debug.20stage0.20segfault.20on.20stage1.html#175987526">(Sep 18 2019 at 09:39)</a>:</h4>
<p>We should document that in some section about how to debug rustc</p>



<a name="175987653"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/debug%20stage0%20segfault%20on%20stage1/near/175987653" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/debug.20stage0.20segfault.20on.20stage1.html#175987653">(Sep 18 2019 at 09:41)</a>:</h4>
<p>indeed. <a href="https://github.com/rust-lang/rust/issues/40902" target="_blank" title="https://github.com/rust-lang/rust/issues/40902">#40902</a> had noted this in a long laundry list</p>



<a name="175987687"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/debug%20stage0%20segfault%20on%20stage1/near/175987687" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/debug.20stage0.20segfault.20on.20stage1.html#175987687">(Sep 18 2019 at 09:41)</a>:</h4>
<p>but then it was closed because it was "not clear that it was usefully tracking anything anymore"</p>



<a name="175987860"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/debug%20stage0%20segfault%20on%20stage1/near/175987860" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/debug.20stage0.20segfault.20on.20stage1.html#175987860">(Sep 18 2019 at 09:43)</a>:</h4>
<p><a href="https://github.com/rust-lang/rustc-guide/issues/443#issuecomment-532608428" target="_blank" title="https://github.com/rust-lang/rustc-guide/issues/443#issuecomment-532608428">https://github.com/rust-lang/rustc-guide/issues/443#issuecomment-532608428</a></p>



<a name="175987961"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/debug%20stage0%20segfault%20on%20stage1/near/175987961" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/debug.20stage0.20segfault.20on.20stage1.html#175987961">(Sep 18 2019 at 09:44)</a>:</h4>
<p>The rustc guide doesn't have any section about how to debug a failure, so I think mentioning this would fit there.</p>



<a name="175987986"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/debug%20stage0%20segfault%20on%20stage1/near/175987986" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/debug.20stage0.20segfault.20on.20stage1.html#175987986">(Sep 18 2019 at 09:44)</a>:</h4>
<p>Just filed rustc-guide#448</p>



<a name="175987994"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/debug%20stage0%20segfault%20on%20stage1/near/175987994" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/debug.20stage0.20segfault.20on.20stage1.html#175987994">(Sep 18 2019 at 09:44)</a>:</h4>
<p>lets go add that as an issue linkifier</p>



<a name="175988053"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/debug%20stage0%20segfault%20on%20stage1/near/175988053" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/debug.20stage0.20segfault.20on.20stage1.html#175988053">(Sep 18 2019 at 09:45)</a>:</h4>
<p><a href="https://github.com/rust-lang/rustc-guide/issues/448" target="_blank" title="https://github.com/rust-lang/rustc-guide/issues/448">rustc-guide#448</a></p>



<a name="175988284"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/debug%20stage0%20segfault%20on%20stage1/near/175988284" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/debug.20stage0.20segfault.20on.20stage1.html#175988284">(Sep 18 2019 at 09:48)</a>:</h4>
<p>hmm anyway <code>--on-fail=bash</code> may not work, due to <a href="https://github.com/rust-lang/rust/issues/47645" target="_blank" title="https://github.com/rust-lang/rust/issues/47645">#47645</a></p>



<a name="175988357"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/debug%20stage0%20segfault%20on%20stage1/near/175988357" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/debug.20stage0.20segfault.20on.20stage1.html#175988357">(Sep 18 2019 at 09:49)</a>:</h4>
<p>(and that in turn may be due to <code>cargo</code> playing games with stdin/stdout.)</p>



<a name="175988522"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/debug%20stage0%20segfault%20on%20stage1/near/175988522" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/debug.20stage0.20segfault.20on.20stage1.html#175988522">(Sep 18 2019 at 09:52)</a>:</h4>
<p>but <code>--on-fail=env</code> <em>should</em> work, even in the presence of <a href="https://github.com/rust-lang/rust/issues/47645" target="_blank" title="https://github.com/rust-lang/rust/issues/47645">#47645</a></p>



<a name="175989489"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/debug%20stage0%20segfault%20on%20stage1/near/175989489" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/debug.20stage0.20segfault.20on.20stage1.html#175989489">(Sep 18 2019 at 10:08)</a>:</h4>
<p>thanks</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>